# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Bradley J Chambers <brad.chambers@gmail.com>
pkgname=libgeotiff
pkgver=1.7.1
pkgrel=3
pkgdesc="TIFF based interchange format for georeferenced raster imagery"
url="https://trac.osgeo.org/geotiff"
arch="all"
license="Public-Domain"
depends_dev="tiff-dev"
makedepends="
	$depends_dev
	autoconf
	automake
	libtool
	proj-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	"
source="https://download.osgeo.org/geotiff/libgeotiff/libgeotiff-$pkgver.tar.gz"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

check() {
	# generate an example GeoTIFF
	bin/makegeo

	# list-out the GeoTIFF tags and keys associated with the generated GeoTIFF
	bin/listgeo newgeo.tif > metadata.txt

	# check if some tags are extracted correctly
	grep "Ellipsoid: 7016/Everest 1830 (1967 Definition) (6377298.56,6356097.55)" metadata.txt
	grep "Projection Linear Units: 9001/metre (1.000000m)" metadata.txt
	grep "Upper Left    (130d 0' 0.00\"E, 32d 0' 0.00\"N)" metadata.txt
	grep "Lower Left    (130d 0' 0.00\"E, 12d 0' 0.00\"N)" metadata.txt
	grep "Upper Right   (150d 0' 0.00\"E, 32d 0' 0.00\"N)" metadata.txt
	grep "Lower Right   (150d 0' 0.00\"E, 12d 0' 0.00\"N)" metadata.txt
}

sha512sums="
af119040598f4349124848d9788ea1d0d2019e23fc48eaf4b0445320c51e91afa6c7e25b49738bdaf0aa4467a19104b00838d669da27dee77898c489fe5fe4c1  libgeotiff-1.7.1.tar.gz
"
